﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL
{
    public partial class DataContext
    {

        public List<HoaDon> GetListHoaDon()
        {
            return db.HoaDons.ToList();
        }
        public HoaDon GetHoaDonById(Guid id)
        {
            return db.HoaDons.Where(c => c.MaHD == id).FirstOrDefault();
        }
        public void DeleteHoaDon(HoaDon cthd)
        {
            db.Entry(cthd).State = EntityState.Deleted;
            db.SaveChanges();
        }
        public void InsertHoaDon(HoaDon cthd)
        {
            db.Entry(cthd).State = EntityState.Added;
            db.SaveChanges();
        }
        public void UpdateHoaDon(HoaDon cthd)
        {
            db.Entry(cthd).State = EntityState.Modified;
            db.SaveChanges();
        }
    }
}
